{include file="public/head" /}

<body>
  <div class="x-body">
      <form class="layui-form"  method="post" action="{:url('admin/admin/adminEdit')}">
          <input type="hidden" value="{$info.id}" name='id'/>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>账号名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="username" name="name" required="" lay-verify="required" autocomplete="off" class="layui-input" value="{$info.name}">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>将会成为您唯一的登入名
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="x-red">*</span>角色</label>
            <div class="layui-input-block">
              {foreach $group as $rol}
                  {if $groupId.group_id == $rol.id}
                      <input type="radio" name="group" lay-skin="primary" title="{$rol.title}" checked="" value="{$rol.id}">
                  {else}
                      <input type="radio" name="group" lay-skin="primary" title="{$rol.title}" value="{$rol.id}">
                  {/if}
              {/foreach}
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_password" class="layui-form-label">
                <span class="x-red">*</span>密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_password" name="password" lay-verify="password"
                autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                不修改密码不需要填写
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
                <span class="x-red">*</span>确认密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_repass" name="repass" lay-verify="repass"
                autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                修改用户
            </button>
        </div>
    </form>
  </div>
  <script>
      layui.use(['form','layer'], function(){
          $ = layui.jquery;
        var form = layui.form
        ,layer = layui.layer;
      
        //自定义验证规则
          form.verify({
              nikename: function(value){
              if(value.length < 6){
                  return '昵称至少得6个字符啊';
              }
              },
              password: function(value, item){
                  if (!!value) {
                      if ( !(/^[0-9a-zA-Z]{6,12}$/.test(value)) ) {
                           return '密码格式不正确'
                      }
                  }
                  
              },
              repass: function(value){
                  if($('#L_password').val()!=$('#L_repass').val()){
                      return '两次密码不一致';
                  }
              }
          });          
      });

      
  </script>
  <script>var _hmt = _hmt || []; (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
    
</body>

</html>